<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>admin</title>
    <link rel="stylesheet" href="../layui/css/layui.css">
    <link rel="stylesheet" href="../css/public.css">
    <script src="../layui/layui.js"></script>
    <script src="../js/base.js"></script>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo">Echat-Admin</div>

        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="javascript:;">
                    <img src="/img/default_user_header.png" class="layui-nav-img">
                    管理员
                </a>
                <dl class="layui-nav-child">
                    <dd><a>基本资料(无效)</a></dd>
                    <dd><a>安全设置(无效)</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item" style="cursor:pointer"><a onclick="logout()">注销</a></li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree" lay-filter="test">
                <li class="layui-nav-item layui-nav-itemed">
                    <a class="" href="javascript:;">用户</a>
                    <dl class="layui-nav-child">
                        <dd>
                            <a id="user" class="base_btn" data-type="tabAdd" data-href="/admin/userIndex.html"
                               lay-id="user">用户管理</a>
                        </dd>
                        <dd>
                            <a id="interface" class="base_btn" data-type="tabAdd" data-href="/admin/interfaceIndex.html"
                               lay-id="interface">接口管理</a>
                        </dd>
                    </dl>
                </li>
            </ul>
        </div>
    </div>

    <div class="layui-body" style="background-color:#F2F2F2">
        <!-- 内容主体区域 -->
        <div style="padding: 15px;" class="layui-tab layui-tab-brief" lay-allowclose="true" lay-filter="demo">
            <ul class="layui-tab-title"></ul>
            <div class="layui-tab-content"></div>
        </div>
    </div>

    <!--
    <div class="layui-footer">
        Echat
    </div>
    -->
</div>
<script>
    var $;
    layui.use(['jquery', 'layer', 'form', 'table'], function () {
        $ = layui.jquery;
        //自动触发user栏目的点击事件
        $('#user').trigger("click");
    });

    function logout() {
        $.ajax({
            url: '/admin/logout'
            , success: function (res) {
                if (res.code == 0) {
                    $(location).attr('href', '/admin/login.html');
                }
            }
        });
    }
</script>
</body>
</html>